package org.jgs2007.onemall.advice;

import lombok.extern.slf4j.Slf4j;
import org.jgs2007.onemall.util.ResponseUtil;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * 全局异常处理增强
 *
 * @author junki
 * @date 2020/10/12 13:56
 */
@RestControllerAdvice
@Slf4j
public class ExceptionHandlerAdvice {

    @ExceptionHandler({RuntimeException.class})
    public Object nullPointerExceptionHandler(RuntimeException e) {

        return ResponseUtil.fail(400, e.getMessage());

    }

}
